// 列表数据显示模块
import * as server from '@/utils/http'
import URL from '@/environment/global'
// 解构赋值
let { HTTP_URL } = URL

/**
 * 根据父级菜单id获取子级菜单
 * method: GET
 * @param parent_menu_id | 父级菜单id
 * @param with_pris | 是否获取权限菜单 (否：false，是：true)
 * @param with_all | 是否获取禁用菜单 (否：false，是：true)
 */
export function getMenuChild (params = {}) {
  return server.get(`${HTTP_URL}/menu/get/by/parent`, params)
}

/**
 * 开启或关闭菜单
 * method: GET
 * @param menu_ids | 菜单编号 String
 * @param type | 开启or关闭 (开启：1，关闭：0)
 */
export function handleMenuState (params = {}) {
  return server.get(`${HTTP_URL}/menu/open/or/close`, params)
}

/**
 * 获取角色列表
 * method: GET
 */
export function getRoleList (params = {}) {
  return server.get(`${HTTP_URL}/role`, params)
}

/**
 * 获取自身菜单及权限
 * method: GET
 */
export function getPersonalMenu () {
  return server.get(`${HTTP_URL}/role/get/pris`)
}

/**
 * 获取用户列表
 * method: GET
 * @param page_size | 页容量
 * @param page | 页码
 * @param name | 用户名称 默认null
 * @param account | 账号 默认null
 */
export function getUserList (params = {}) {
  return server.get(`${HTTP_URL}/user`, params)
}

/**
 * 菜单排序
 * method: GET
 * @param menu_id | 当前菜单编号
 * @param menu_parent_id | 目标菜单的id
 * @param order | 排序序号 若父级改变 则参数无效
 */
export function changeMenuOrder (params = {}) {
  return server.get(`${HTTP_URL}/menu/order/one`, params)
}

/**
 * 菜单一键重置排序
 * method: GET
 */
export function menuSortReturn () {
  return server.get(`${HTTP_URL}/menu/reset/all`)
}

/**
 * 冻结 解冻账号
 * method: GET
 * @param ids String | 账号id
 * @param op String | 状态(0 冻结, 1 解冻)
 */
export function freezeOrThaw (parmas = {}) {
  return server.get(`${HTTP_URL}/user/frozen/or/thaw`, parmas)
}

/**
 * 获取绑定的用户
 * @param id String | 角色id
 */
export function getBindUser (id) {
  return server.get(`${HTTP_URL}/role/get/bind/user?id=` + id)
}

/**
 * 获取阶段列表
 * @export
 * @param {*} [params={}]
 */
export function getStageList (params = {}) {
  return server.get(`${HTTP_URL}/budget/time`, params)
}

/**
 * 获取预算填报时间列表
 * method: GET
 */
export function getFillList (params = {}) {
  return server.get(`${HTTP_URL}/budget/write/stage/list`, params)
}

/**
 * 获取预算填报树级列表
 * method: GET
 * @param stage_id | 时间列表id
 */
export function getFillTree (params = {}) {
  return server.get(`${HTTP_URL}/budget/write`, params)
}

/**
 * 获取申报人列表
 * 获取预算外编制的类型阶段列表
 * method: get
 */
export function getUploaderList () {
  return server.get(`${HTTP_URL}/user/get/list`)
}

/**
 * 预算编制阶段 预算填报提交 撤回
 * @param {String} id 预算申报信息id
 * @param {String | Number} op 操作基数 0撤回 1提交
 */
export function resolveOrReject (params = {}) {
  return server.get(`${HTTP_URL}/budget/write/submit/or/rollback`, params)
}

/**
 * 预算编制阶段 审核 可审核预算阶段列表
 */
export function getExamineList (params = {}) {
  return server.get(`${HTTP_URL}/budget/audit/stage/list`, params)
}

/**
 * 预算编制阶段 审核 获取填报的预算信息
 * @param {String} stage_id 父级id
 * @param {String} department 系别
 * @param {String | Number} kind 项目类型(1行政 2教学 3公共)
 */
export function getExamineTree (params = {}) {
  return server.get(`${HTTP_URL}/budget/audit`, params)
}

/**
 * 获取预算外编制的内容阶段列表
 * method: get
 */
export function getStageListOffBuddget (params = {}) {
  return server.get(`${HTTP_URL}/off/budget/category/stage/list`, params)
}

/**
 * 获取预算外编制的内容阶段列表
 * method: get
 */
export function getStageListContentOffBuddget (params = {}) {
  return server.get(`${HTTP_URL}/off/budget/sum/stage/list`, params)
}

/**
 * 获取预算外编制的类型列表
 * method: get
 */
export function getContentListCategoryOffBuddget (params = {}) {
  return server.get(`${HTTP_URL}/off/budget/category`, params)
}

/**
 * 获取预算外编制的内容列表
 * method: get
 */
export function getContentListOffBuddget (params = {}) {
  return server.get(`${HTTP_URL}/off/budget/sum`, params)
}

/**
 * 获取预算外编制的类型--下拉框
 * method: get
 */
export function getCategorySelectOffBuddget (params = {}) {
  return server.get(`${HTTP_URL}/off/budget/sum/category/list`, params)
}

/**
 * 获取预算执行阶段的汇总表的阶段列表
 * method: get
 */
export function getStageListExecuteStage (params = {}) {
  return server.get(`${HTTP_URL}/project/summary/stage/list`, params)
}

/**
 * 获取预算执行阶段的汇总表的内容列表
 * method: get
 */
export function getContentListExecuteStage (params = {}) {
  return server.get(`${HTTP_URL}/project/summary`, params)
}

/**
 * 获取预算执行阶段的项目台账的阶段列表
 * method: get
 */
export function getStageListExecuteStageStandingBook (params = {}) {
  return server.get(`${HTTP_URL}/project/summary/stage/list`, params)
}

/**
 * 获取预算执行阶段的项目台账的项目列表
 * method: get
 */
export function getProjectContentListExecuteStageStandingBook (params = {}) {
  return server.get(`${HTTP_URL}/project/standing/book`, params)
}

/**
 * 获取预算执行阶段的项目台账的详情
 * method: get
 */
export function getProjectContentInfoExecuteStageStandingBook (params = {}, id) {
  return server.get(`${HTTP_URL}/project/standing/book/` + id, params)
}

/**
 * 获取预算执行的单类管理的阶段信息
 * method: get
 */
export function getStageListExecuteStageCategory (params = {}) {
  return server.get(`${HTTP_URL}/bill/category/stage/list`, params)
}

/**
 * 获取预算执行的单类管理的列表信息
 * method: get
 */
export function getContentListExecuteStageCategory (params = {}) {
  return server.get(`${HTTP_URL}/bill/category`, params)
}

/**
 * 获取预算执行的 报单填报 的阶段信息
 * method: get
 */
export function getStageListExecuteStageBillWrite (params = {}) {
  return server.get(`${HTTP_URL}/bill/write/stage/list`, params)
}

/**
 * 获取预算执行的 报单填报 的 项目列表
 * method: get
 */
export function getProjectListExecuteStageBillWrite (params = {}) {
  return server.get(`${HTTP_URL}/bill/write`, params)
}

/**
 * 获取预算执行的 报单填报 的 填报记录列表
 * method: get
 */
export function getWriteLogListExecuteStageBillWrite (params = {}) {
  return server.get(`${HTTP_URL}/bill/write/show/log`, params)
}

/**
 * 获取预算执行的 报单审核 的阶段信息
 * method: get
 */
export function getStageListExecuteStageBillAudit (params = {}) {
  return server.get(`${HTTP_URL}/bill/audit/stage/list`, params)
}

/**
 * 获取预算执行的 报单审核 的 报单列表
 * method: get
 */
export function getBillListExecuteStageBillAudit (params = {}) {
  return server.get(`${HTTP_URL}/bill/audit`, params)
}

/**
 * 获取预算执行的 回执单填报 的阶段信息
 * method: get
 */
export function getStageListExecuteStageReceiptWrite (params = {}) {
  return server.get(`${HTTP_URL}/receipt/write/stage/list`, params)
}

/**
 * 获取预算执行的 回执单填报 的 报单 列表信息
 * method: get
 */
export function getWriteListExecuteStageReceiptWrite (params = {}) {
  return server.get(`${HTTP_URL}/receipt/write`, params)
}

/**
 * 获取预算执行的 回执单审核 的阶段信息
 * method: get
 */
export function getStageListExecuteStageReceiptAudit (params = {}) {
  return server.get(`${HTTP_URL}/receipt/audit/stage/list`, params)
}

/**
 * 预算审核通过驳回
 * @param {String} id 预算项目id
 * @param {String | Number} op 审核(1通过 0驳回)
 * @param {String} reason 驳回原因
 */
export function budgetAudit (params = {}) {
  return server.get(`${HTTP_URL}/budget/audit/one/audit`, params)
}
/**
 * 获取预算执行的 回执单审核 的 审核 列表信息
 * method: get
 */
export function getAuditListExecuteStageReceiptAudit (params = {}) {
  return server.get(`${HTTP_URL}/receipt/audit`, params)
}

/**
 * 获取预算编制的 预算明细 的 阶段信息
 * method: get
 */
export function getStageListBudgetMxManage (params = {}) {
  return server.get(`${HTTP_URL}/budget/mx/stage/list`, params)
}

/**
 * 获取预算编制的 预算明细 的 内容信息
 * @param {*} params
 */
export function getContentListBudgetMxManage (params = {}) {
  return server.get(`${HTTP_URL}/budget/mx`, params)
}

/**
 * 申报填写界面--上级项目信息加载
 */
export function getBillFatherPrjInfo (params = {}) {
  return server.get(`${HTTP_URL}/bill/write/get/mx/info`, params)
}

/**
 * 申报填写界面-报单类型下拉框
 */
export function getBillCategoryList (params = {}) {
  return server.get(`${HTTP_URL}/bill/category/get/list`, params)
}

/**
 * 申报填写界面--申报人下拉框
 */
export function getUploadList () {
  return server.get(`${HTTP_URL}/user/get/list`)
}

/**
 * 提交和撤回报单
 */
export function billResolveOrRject (params = {}) {
  return server.get(`${HTTP_URL}/bill/write/submit/or/rollback`, params)
}

/**
 * 查看报单详情
 */
export function getBillWriteInfo (id) {
  return server.get(`${HTTP_URL}/bill/write/${id}`)
}

/**
 * 查看报单详情
 */
export function getBillAudit (id, params = {}) {
  return server.get(`${HTTP_URL}/bill/audit/${id}`, params)
}

/**
 * 审核报单
 */
export function billAuditOneAudit (params = {}) {
  return server.get(`${HTTP_URL}/bill/audit/one/audit`, params)
}

/**
 * 查看回执单详情
 */
export function getReceiptInfo (id, params = {}) {
  return server.get(`${HTTP_URL}/receipt/write/${id}`, params)
}

/**
 * 回执单提交or撤回
 */
export function receiptResolveOrReject (params = {}) {
  return server.get(`${HTTP_URL}/receipt/write/submit/or/rollback`, params)
}

/**
 * 审核回执单
 */
export function receiptAuditOneAudit (params = {}) {
  return server.get(`${HTTP_URL}/receipt/audit/one/audit`, params)
}
